import routerGenerator from 'koa-router'
import FileController from './controller/file'

const router = new routerGenerator()
const prefix = '/api'

router.get(`${prefix}/:name`, async (ctx, next) => {
  const name = ctx.params.name
  ctx.response.body = `Hello ${name}`
})

router.get(`${prefix}/list/:path`, async (ctx, next) => {
  const path = ctx.params.path
  ctx.response.body = await FileController.list(path)
})

export default router
